gtkprintbackendcups: Fix a crash in gtk_print_backend_cups_finalize()
authorCarlos Garcia Campos <cgarcia@igalia.com>
Mon, 25 Mar 2013 11:09:52 +0000 (12:09 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 25 Mar 2013 13:40:50 +0000 (14:40 +0100)
If GtkPrintBackendCups is finalized and cups_get_printer_list hasn't
been called, g_object_unref is called for the GDBusConnection pointer
that is NULL. Use g_clear_object() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=696546

modules/printbackends/cups/gtkprintbackendcups.c

index 64b92bcddde4e5e4a0477b0f30eb9ec67fef5154..45aa007bceab44434579053aaa9db741c01b6da1 100644 (file)
@@ -852,7 +852,7 @@ gtk_print_backend_cups_finalize (GObject *object)
 
   g_clear_object (&backend_cups->avahi_cancellable);
   g_clear_pointer (&backend_cups->avahi_default_printer, g_free);
-  g_object_unref (backend_cups->dbus_connection);
+  g_clear_object (&backend_cups->dbus_connection);
 #endif
 
   backend_parent_class->finalize (object);